package com.nervenets.web.controller.handler.user.user;

import com.nervenets.web.controller.handler.Handler;
import com.nervenets.web.controller.handler.common.IdTokenParams;
import com.nervenets.web.entity.MessageCode;
import com.nervenets.web.hibernate.domain.user.Address;

import javax.servlet.http.HttpServletRequest;

public class UserAddressDetailHandler extends Handler<IdTokenParams> {
    @Override
    public String handle(IdTokenParams params, HttpServletRequest request) throws Exception {
        final Address address = userDao.findById(params.getTargetId(), Address.class);
        if (null == address) return errorMessage(MessageCode.code_404, "地址不存在");
        return successMessage(address);
    }

    @Override
    public String result() throws Exception {
        return successMessage(new Address());
    }
}
